package com.atguigu.edu.controller.client;

import com.atguigu.edu.entity.vo.front.CourseWebVo;
import com.atguigu.edu.entity.vo.order.CourseOrderVo;
import com.atguigu.edu.service.CourseService;
import io.swagger.annotations.Api;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/edu/service/client")
@Api(value = "ClientCourseController", description = "Course-Order接口/feign")
public class ClientCourseController {
    @Autowired
    CourseService courseService;

    @GetMapping("/getCourseInfo/{courseId}")
    public CourseOrderVo getCourseOrderInfo(@PathVariable String courseId) {
        //根据课程id，编写sql语句查询课程信息
        CourseWebVo courseWebVo = courseService.getBaseCourseInfo(courseId);

        CourseOrderVo courseOrderVo = new CourseOrderVo();
        BeanUtils.copyProperties(courseWebVo,courseOrderVo);
        courseWebVo = null;
        return courseOrderVo;
    }

}
